package com.jhd.fuzhou.view.login;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.jhd.fuzhou.R;
import com.jhd.fuzhou.downloadmanager.Utils.DeviceUtils;
import com.jhd.fuzhou.view.task.TaskActivity;

import net.zigin.commons.util.StringUtil;

import butterknife.BindView;
import butterknife.OnClick;

public class MineActivity extends BaseActivity {
    @BindView(R.id.btn_sy)Button btn_sy;
    @BindView(R.id.btn_unregister)Button btn_unregister;
    @BindView(R.id.tv_person)TextView tv_person;//姓名
    @BindView(R.id.tv_gender)TextView tv_gender;//性别
    @BindView(R.id.tv_organization)TextView tv_organization;//所属单位
    @BindView(R.id.tv_department)TextView tv_department;//科室
    @BindView(R.id.tv_law_enforcement_number)TextView tv_law_enforcement_number;//执法证号
    @BindView(R.id.tv_phone)TextView tv_phone;//手机号
    @BindView(R.id.tv_version)TextView tv_version;//版本号
    private Context context=this;

    @Override
    protected void loadViewLayout() {
        setContentView(R.layout.activity_mine);
    }

    @Override
    protected void processLogic() {
        input();
    }
    /*显示个人信息*/
    private void input(){
        tv_person.setText(StringUtil.isNullOrEmpty(application.getName())?"":application.getName());
        tv_gender.setText(StringUtil.isNullOrEmpty(application.getGender())?"":application.getGender());
        tv_organization.setText(StringUtil.isNullOrEmpty(application.getOrgName())?"":application.getOrgName());
        tv_department.setText(StringUtil.isNullOrEmpty(application.getDeptName())?"":application.getDeptName());
        tv_law_enforcement_number.setText(StringUtil.isNullOrEmpty(application.getLawEnforceNo())?"":application.getLawEnforceNo());
        tv_phone.setText(StringUtil.isNullOrEmpty(application.getMobileNo())?"":application.getMobileNo());
        tv_version.setText(""+DeviceUtils.getVersionCode(context));
    }

    @OnClick({R.id.btn_sy,R.id.btn_unregister,R.id.btn_task,R.id.rel_change_password})
    public void onClick(View view){
        switch (view.getId()){
            case R.id.btn_sy:
                startActivity(new Intent(context, MainActivity.class));
                finish();
                break;
            case R.id.btn_unregister:
                application.clearAll();
                startActivity(new Intent(context, LoginActivity.class));
                finish();
                break;
            case R.id.btn_task:
                startActivity(new Intent(context, TaskActivity.class));
                finish();
                break;
            case R.id.rel_change_password:
                startActivity(new Intent(context, ForgetPasswordActivity.class));
                break;
        }
    }
}